Hello and welcome to this you in this video.
We are going to add the javascript functionality that all make the conversion tool work inside our hastier
mail are ready made a reference so the external javascript so now we can create the file.
So I'm going to click on file new and I'll save this file on to save us and I'm going to call it cagy
to get daut G.
Yes I see.
So if you look on the bottom right hand corner is now showing as jabba's scripts.
Any code that add in here will be a javascript court.
I've already started to code some and it can explain the code line by line.
So I added the javascript code is not a lot.
I've just run through that with you.
I have created a function called weight converter and inside the parentheses are passed in the Value.
Number two a bizarre glitch.
This will represent the number you passing into the input.
If you're converting from kg to a pound one pound is equivalent of two point to zero for six kg has
created a variable here online to call Val.
This would represent the value of the number you put in a set that took a quarter to the value of that
number.
TIMES TWO point to zero for six.
This is because 1 pound is equivalent to two point two zero forces in kg and here online online 3.
I have created a variable called N and that set that of course to this variable called value.
No dot to fix this is a method that you can use to round up two decimal places so you put the value
of decimal places you want to round it too.
For example if you want the values to be rounded up to one decimal place you pull one.
If you want to decimal places you put two.
In my case I won it.
I don't want any decimal places.
I just won a round number.
So he's going to fix that so that there's no zero numbers out to the number.
So are just going to return a whole number line for here is the document.
Don't get element but.
And this idea is for frame to is called outport pounce telling you to put the value in pownce and we
come here at our hastier mail we can see a reference to that.
I am talking about here.
So I've got an idea here.
This is the I'm talking about the owls Port pownce Okay so this is a Span idea.
That's what I'm referring to here.
So to get this value here and then replace it with the.
In the history AML.
So to use the value of this N which is here if we going to have r t e mail.
So back you can see here inside the jabba's group we have got a variable called N and this is the Vallium
given it so it will grab the document.
Getting on meant by it.
This method will grab this span element which is inherent in a email.
Output.
Pounce on it or attach it to replace that with the value of n t can see.
This is the value of n her right.
So let's save that.
Let's test the application a quick save or someone will pull up the directory and click on the hayse
TMF file to run it.
Now if I put any value in KG for let's say we'll say 9 to 5.
You can see he's giving me the corresponding value in pownce so the functionality of the conversion
tool is working in the next chart.
I'm just going to make it look a little bit nicer by adding some to assess.
Thanks for watching.
Bye for now.